import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";

import UndrawUi from 'undraw-ui'


import Pagination from "./components/Pagination/index.vue";
import RightToolbar from "./components/RightToolbar/index.vue";
import store from "./store";
import "./styles/index.scss";
import "@/styles/color/index.scss";
import ElementPlus, { ElMessage,ElMessageBox   } from "element-plus";
import "element-plus/lib/theme-chalk/index.css";
// 国际化
import { createI18n } from "vue-i18n";
import messages from "@/utils/language";
//阿里图标
import "@/components/svg/svg";
import icons from "@/components/svg/svg.vue";
import 'xe-utils'
import VXETable from 'vxe-table'
import  InfoFilled  from '@element-plus/icons-vue'
import SlideVerify from 'vue-monoplasty-slide-verify';
import LemonIMUI from 'lemon-imui';
import 'lemon-imui/dist/index.css';
import 'vxe-table/lib/style.css'
import axios from "axios";
import './common/directives'
import VueQuillEditor from 'vue-quill-editor';
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';


const i18n = createI18n({
    locale: "zh-CN", //默认显示的语言
    messages,
});

function useTable (app: any) {
    app.use(VXETable)
    app.config.globalProperties.$message =ElMessage
    app.config.globalProperties.$messagebox =ElMessageBox
 
    // 给 vue 实例挂载内部对象，例如：
    // app.config.globalProperties.$XModal = VXETable.modal
    // app.config.globalProperties.$XPrint = VXETable.print
    // app.config.globalProperties.$XSaveFile = VXETable.saveFile
    // app.config.globalProperties.$XReadFile = VXETable.readFile
  }

createApp(App)
    .use(store)
    .use(router)
    .use(ElementPlus)
    .use(i18n)
    .use(useTable)
    .use(UndrawUi)
    .use(LemonIMUI)
    .use(SlideVerify)
    .use(VueQuillEditor)
    .component('icons',icons)
    .component('Pagination', Pagination)
    .component('RightToolbar', RightToolbar)
    .directive('hasPermi',function(el,binding,vnode){
        let btnPre =store.getters.getBtnPer
        console.log(`obj`, btnPre);
        let obj =btnPre.find((item)=>{
            
            if(item == binding.value == true){
                return true
            }
        })
       
        if(obj){

        }else{
            
            el.setAttribute('style','display:none')
            
        }
        
        console.log(`store.getters.getBtnPer`,store.getters.getBtnPer );
        console.log(el);  //获取v-model的值
        console.log(binding.value) //data-name绑定的值，需要el.dataset来获取
        console.log(vnode); //获取当前路由信息
    })
    .mount("#app")
 

//     const app=createApp(App);
// app.component('icons', icons) 
// 前置拦截

